/**
 * Created by zhangwenlei on 2017/4/11.
 */
ADF.control.TextArea = function() {
    ADF.control.TextArea.superclass.constructor.call(this);
};

COM.util.defineClass(ADF.control.TextArea, ADF.ControlDescriptor, {

    getEditpart: function() {
        var editpart = function() {
            editpart.superclass.constructor.call(this);
        };
        COM.util.defineClass(editpart, ADF.editpart.BaseEditpart, {
            _createFigure: function() {
                var textareaFigure = new AGEF.WidgetFigure(this.id);
                var textarea = this.getWidgetFactory().createControl(this.getModel());
                textareaFigure.setWidget(textarea);
                return textareaFigure;
            },
            // createEditPolicies: function() {
            //     this.installEditPolicy(COM.gef.EditPolicy.COMPONENT_ROLE, new ADF.policy.TextAreaComponentEditPartPolicy());
            // },
            propertyChange: function(evt) {
                editpart.superclass.propertyChange.call(this, evt);
                if (AGEF.PropertyChangeEvent.UPDATE_EVENT == evt.getType()) {
                    if (ADF.model.TextAreaModel.PROPERTY_TEXT == evt.getPropertyName()) {
                        this.getFigure().getWidget().setText(evt.newValue);
                    }
                }
            }
        });
        return editpart;
    },

    getModel: function() {
        return ADF.model.TextAreaModel;
    },

    getDomControl : function(){
        return ADF.domControl.TextArea;
    }

});